<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function myConstructor(message){
	//在这里定义的变量都是私有变量
		var sparator = ' -';
		alert(message);
		this.message = message;
		this.show = function(){
			alert('展示选择的内容'+sparator);
			};
	};
myConstructor.prototype.clearMessage = function(string){
	this.myMessage += '' + string;
	};
//通过追加属性的方式也不能访问私有变量；
myConstructor.prototype.appendToMessage = function(string){
	this.meMessage += sparator + string;
	};

var myObject = null;
myObject=myObject || new myConstructor("hellow word!");
myObject.clearMessage();
myObject.show();
myObject.appendToMessage('abc');
</script>
<title>无标题文档</title>

</head>

<body>
</body>
</html>
